package com.todo.user.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/4/9 10:12
 * @description
 */
@Getter
@AllArgsConstructor
public enum UserLikeTypeEnum {

    CONTENT(1, "CONTENT", "内容"),
    STRATEGY(2, "STRATEGY", "攻略"),
    SIGHT(3, "SIGHT", "景点"),
    ;

    private static Map<Integer, UserLikeTypeEnum> typeMap = Arrays
            .stream(UserLikeTypeEnum.values())
            .collect(Collectors.toMap(UserLikeTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static UserLikeTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
